def greet(name, age, city):
    print(f"姓名: {name}, 年龄: {age}, 城市: {city}\n")


def de_constructor(name, age, city="suzhou", *args, **kwargs):
    print(f"name={name},age={age},city={city},args={args},kwargs={kwargs}")


# 定义列表参数
list_person_params = ["alice", 19, "北京"]

# 定义元组参数
tuple_person_params = ("linda", 20, "上海")

# 定义字典参数
dict_person_params = {"name": "张三", "age": 30, "city": "北京"}

greet(*list_person_params)  # 列表解包
greet(*tuple_person_params)  # 元组解包
greet(**dict_person_params)  # 字典解包
greet(**{k: v for k, v in dict_person_params.items()})


def print_hybird_info(xm, *args, x=1, **kwargs):
    print(f"xm={xm},args={args},x={x},kwargs={kwargs}")
    for k, v in kwargs.items():
        print(f"{k}={v}")


print_hybird_info(100, 200, [1, 2, 3], x=500, name="张三", age=30, city="北京")


# 函数返回多个值，实际上返回的是一个元组
def operate_numbers(a, b):
    sum_result = a + b
    diff_result = a - b
    product_result = a * b
    quotient_result = a / b
    tuple_nums = (1, 2, 3)
    list_nums = [4, 5, 6]
    set_nums = {7, 8, 9}
    return (
        sum_result,
        diff_result,
        product_result,
        quotient_result,
        tuple_nums,
        list_nums,
        set_nums,
    )


result = operate_numbers(10, 5)
sum, minus, mul, div, *rest = result

print(sum, minus, mul, div, "rest=", rest)
